fix: 日本語 IME オンのままでも Space でチェックを切り替えられるようにする - #129
Merged
Conversation
macOS の日本語入力では、かな入力中の Space は全角スペース(U+3000)として 確定されてアプリへ届き、半角スペースが来るのは Shift+Space のときだけ。 端末は IME が確定した文字列を送ってくるだけなので `input === ' '` は必ず 外れ、質問ダイアログ(AskUserQuestion)の複数選択チェックと /config の ON/OFF が「Shift+Space でしか押せない」状態になっていた。 キー操作としての Space 判定を純粋な `isSpaceKey`(半角と U+3000 の両方を Space とみなす)に寄せ、両ダイアログで使う。文字として挿入する経路 (コンポーザ)は通さないので、打った全角スペースは全角のまま入る。 ついでに /config は他画面と同じく normalizeChord を通すようにした (modifyOtherKeys / CSI-u を送る端末では Enter / Space が生のエスケープ列で 届き、素の比較が外れるため)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ Shift+Space が必要だったのか
日本語 IME の仕様でした。codiva 側の設計判断ではありません。
macOS の日本語入力では、かな入力モードで未変換のまま
Spaceを押すと 全角スペース(U+3000) が確定して入力されます。半角スペースが送られるのはShift+Spaceのときだけです。端末は IME が確定した文字列をそのまま送ってくるだけなので、アプリからは「押されたのは Space キー」だと分からず、input === ' 'の比較は必ず外れます。その結果、
/configの ON/OFF トグルが「IME を切るか
Shift+Spaceを押さないと反応しない」状態になっていました。変更
core/key-sequence.tsに純粋なisSpaceKey(input)を追加(半角スペースと U+3000 の両方を Space キーとみなす)。ui/permission-dialog.tsx)と/config(ui/config-select.tsx)の判定をこれに寄せた。/configも他画面と同じくnormalizeChordを通すようにした(modifyOtherKeys / CSI-u を送る端末ではEnter/Spaceが生のエスケープ列で届き、素の比較が外れるため)。/configの表)と docs/TECH_NOTES.md(Ink 7 の実装メモ)に理由を記載。なお、ツール許可の
y/nのような英字キーは IME が preedit に吸ってしまうため原理的に届きません(回避策は IME を切ること)。README にもその旨を書いています。テスト
core/key-sequence.spec.ts:isSpaceKeyのテーブルテスト(半角 / 全角 / 空 / タブ / 複数スペース / 通常文字)。ui/permission-dialog.spec.tsx: 全角スペースで複数選択がトグルされる(既存の「素の Space」「modifyOtherKeys の Space」ケースの隣)。tests/commands.test.tsx:/configが全角スペースでも切り替わる。npm run lint(Biome 2.5.4)npm run typechecknpm test(115 files / 2935 tests)npm run build実機での体感確認(IME をオンにしたまま
Spaceでチェックが付くか)※ TTY が要るのでお願いします